/**
 * BaseController.java
 */
package org.yate.oa.controller;

import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.yate.oa.utils.DateUtil;


/**
 * @author Yate
 * @date May 29, 2014
 * @description TODO
 * @version 1.0
 */
public abstract class BaseController {
	protected final Logger log = LoggerFactory.getLogger(this.getClass());
	
	/**
	 * @description 绑定日期格式
	 * @param binder
	 */
	@InitBinder
	protected void initBinder(WebDataBinder binder) {
		binder.registerCustomEditor(
				Date.class,
				new CustomDateEditor(DateUtil.getDateFormat(DateUtil.DATATIMEF_STR), true));
//		binder.registerCustomEditor(
//				Date.class,
//				new CustomDateEditor(DateUtil.getDateFormat(DateUtil.DATAFORMAT_STR), true));
//		binder.registerCustomEditor(
//				Date.class,
//				new CustomDateEditor(DateUtil
//						.getDateFormat(DateUtil.DATAFORMAT_STR), true));
//		binder.registerCustomEditor(
//				Date.class,
//				new CustomDateEditor(DateUtil
//						.getDateFormat(DateUtil.DATAFORMAT_STR), true));
//		binder.registerCustomEditor(
//				Date.class,
//				new CustomDateEditor(DateUtil
//						.getDateFormat(DateUtil.DATAFORMAT_STR), true));
//		binder.registerCustomEditor(
//				Date.class,
//				new CustomDateEditor(DateUtil
//						.getDateFormat(DateUtil.DATAFORMAT_STR), true));
	}
	
}
